package 编程题;

import java.util.*;

public class Num_8_1_01{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){

            int year1 = sc.nextInt();
            int month1 = sc.nextInt();
            int day1 = sc.nextInt();

            int year2 = sc.nextInt();
            int month2 = sc.nextInt();
            int day2 = sc.nextInt();

            int[] arr = {29, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
            //   0    1   2  3   4   5   6   7   8    9   10  11  12

            int sum = 0;

            //year
            for(int i = year1; i < year2; i++){
                for(int j = 1; j <= 12; j++){

                    if(j == 2){
                        if(run(i)){
                            sum += (arr[0] * sus(j));
                        }else{
                            sum += (arr[2] * sus(j));
                        }
                    }else{

                        sum += (arr[j] * sus(j));

                    }

                }
            }

            //month
            for(int j = month1; j < month2; j++){

                if(j == 2){
                    if(run(year2)){
                        sum += (arr[0] * sus(j));
                    }else{
                        sum += (arr[2] * sus(j));
                    }
                }else{

                    sum += (arr[j] * sus(j));

                }

            }

            sum += (day2 - day1 + 1) * sus(month2);
            System.out.println(sum);

        }

    }
    //判断是否为闰年
    private static boolean run(int n){
        if(n % 4 == 0 && n % 100 != 0){
            return true;
        }
        if(n % 400 == 0) return true;

        return false;
    }

    //判断是否为素数 是返回 2 否则 1
    private static int sus(int n){

        if(n == 1)return 2;

        if(n <= 3)return 1;

        for(int i = 2; i <= Math.sqrt(n); i++){
            if(n % i == 0){
                return 2;
            }
        }

        return 1;
    }

}